function quickSort(arr=[]){
    let {length} = arr;
    // arr[0]
    if(length <= 1){
        return arr
    }

    let pivot = arr[0]; //基准点  //3

    let left = []; //比基准点小的

    let right = []; //比基准点大的或者等于

    for(let i = 1;i < length;i++){
        if(arr[i] >= pivot){
            right.push(arr[i]) //[4,6,3]
        }else{
            left.push(arr[i]) //[2,1]
        }
    }

    let l = quickSort(left); //[1] 2

    let r = quickSort(right); //[3] 4 [6]

    return l.concat(pivot).concat(r)
}

console.log(quickSort([3,2,4,6,1]))